#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Reader for COG hitp file"""
__author__ = "Lei Chen <hide1713@gmail.com>"

import os.path
import logging

class HitpFileReader(object):
    """Read Cog Hitp file
    """
    
    def __init__(self, ):
        """
        """
        self.log = logging.getLogger(self.__class__.__name__)

    def read_hitp_values_from_file(self, file_path):
        """Return a list of Hitp from file
        
        Arguments:
        - `file_path`: string
        """
        hitp41 = []
        if os.path.exists(file_path):
            hitp_file= open(file_path)
            if hitp_file:
                self.log.debug("Reading" + file_path)
                for line in hitp_file:
                    if not line.startswith("#"):
                        hitp41.append(float(line.split()[10]))
            return hitp41
        else:
            self.log.error("hitp file: %s not exists."%file_path)
            
        



